package com.woke.adapter;

import java.util.ArrayList;
import java.util.List;

import com.zhongcai.online.R;
import com.woke.data.Data_huoqi;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Huoqilistadter extends BaseAdapter{
	private LayoutInflater mInflater;
	private List<Data_huoqi> datalist;

	public Huoqilistadter(LayoutInflater minflater, ArrayList<Data_huoqi> datalist) {
		this.mInflater = minflater;
		this.datalist = datalist;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return datalist.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	
	class Holder {
		TextView mText_money;
		TextView mText_time;
		TextView mText_title;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Holder holder = null;
		if(convertView == null){
			holder = new Holder();
			convertView = mInflater.inflate(R.layout.item_adapter_huoqi, null);
			holder.mText_money = (TextView) convertView.findViewById(R.id.item_huoqi_textmoney);
			holder.mText_time = (TextView) convertView.findViewById(R.id.item_huoqi_texttime);
			holder.mText_title = (TextView) convertView.findViewById(R.id.item_huoqi_texttitle);
			convertView.setTag(holder);
		}else{
			 holder = (Holder) convertView.getTag();
		}
		
		Data_huoqi data = datalist.get(position);
//		if(data.status.equals("1")){
			holder.mText_money.setText("+"+data.money);
//		}else if(data.status.equals("2")){
//			holder.mText_money.setText("-"+data.money);
//		}
		holder.mText_time.setText(data.create_time);
		holder.mText_title.setText(data.note);
		return convertView;
	}

}
